CocoaVideoFrameToGWorld sample code
11/18/02

This Cocoa sample demonstrates how to step frame-by-frame through a QuickTime movie using the GetNextInterestingTime function, drawing each frame of the movie into a GWorld using a decompression sequence. The offscreen GWorld contents are then drawn into a Cocoa NSQuickDrawView (using the NSQuickDrawView's QuickDraw port) for display. Other drawing is also done into the NSQuickDrawView using Cocoa, Core Graphics and QuickDraw routines.

Lastly, a compile flag is provided which allows drawing into the NSQuickDrawView's QuickDraw port directly, bypassing the offscreen GWorld (Note - if you select this option to have QuickTime draw _directly_ to the NSQuickDrawView's QuickDraw port (via SetMovieGWorld), QuickTime essentially creates a subwindow which appears inside the main window to perform it's drawing. It's contents can completely cover the contents of the window buffer where all Cocoa drawing takes place so even if you try drawing on top (compositing) of it you will only see the movie drawing).

Simply launch the application, and at the prompt, select a movie file to display. Press the "NextFrame" button to advance frame-by-frame through the movie (note: for MPEG-4 movies the above technique will work, but not MPEG-1 or 2 because with these movie files all frames are treated as a single large sample in the movie).